package com.buba.appointment.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.buba.appointment.mapper.NucleicAcidAppointmentMapper;
import com.buba.appointment.service.NucleicAcidAppointmentService;
import com.buba.pojo.appointment.NucleicAcidAppointment;
import com.buba.utils.R;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xhh
 * @since 2022-06-13
 */
@Service
public class NucleicAcidAppointmentServiceImpl extends ServiceImpl<NucleicAcidAppointmentMapper, NucleicAcidAppointment> implements NucleicAcidAppointmentService {
    @Autowired
    NucleicAcidAppointmentMapper mapper;
    @Override
    public R nucleicAcidEcho() {



        return null;
    }


    public List<LocalDate> getNowWeek(){
        int week=0;
        LocalDate localDate=LocalDate.now().plusWeeks(week);
        List<LocalDate> localDateList=new ArrayList<>(7);
        for (int i=0;i<7;i++) {
            localDateList.add(localDate.plusDays(i));
        }
        for (LocalDate date : localDateList) {
            System.out.println(date.toString()+","+date.getDayOfWeek().getValue());
        }
        return localDateList;
    }














    @Test
    public void getWeek(){
        //LocalDate localDate=LocalDate.parse("2022-06-20",DateTimeFormatter.ofPattern("yyyy-MM-dd")).plusWeeks(0);
        LocalDate localDate=LocalDate.now().plusWeeks(1);
        //DayOfWeek dayOfWeek = localDate.getDayOfWeek();
        //int todayWeek=dayOfWeek.getValue();
        List<LocalDate> localDateList=new ArrayList<>();
        for (int i=0;i<7;i++) {
            localDateList.add(localDate.plusDays(i));
        }
        //for(int i=1;i<=7;i++){
        //    if(i<todayWeek){
        //        localDateList.add(localDate.minusDays(todayWeek-i));
        //    }
        //    else if(i>=todayWeek){
        //        localDateList.add(localDate.plusDays(i-todayWeek));
        //    }
        //}

        for (LocalDate date : localDateList) {
            System.out.println(date.toString()+","+date.getDayOfWeek().getValue());
        }
    }

}
